home *** CD-ROM | disk | FTP | other *** search
- ;MailRun 2.1 add-in script for new file scans
-
-
- ;Note that this script uses the value of TaskItem (the currently selected
- ;line in the Task List) to determine the current BBS. It will therefore
- ;not function properly when the user manually changes the selected item
- ;just prior to execution of this script.
-
-
- #define BBS s3
- #define TempDir s6
- #define MailRunIni s7
- #define MailRun s8
- #define TaskItem s9
- #define IdleTimer i0
- #define AnsiInLog i5
- #define LogRun i7
-
- string prompt, BBSType
- integer holdstatus
-
- proc main
- string BBSLst, CapFile, TmpCap, MailRunDir
- ;find last default capture file
- fetch capture file CapFile
- ;change the default capture file
- capture OFF
- set capture file "_tmp.cap"
- set capture mode create VISUAL
- capture ON
-
- ;find current BBSType, etc.
- profilerd MailRun BBS "BBSType" BBSType
- profilerd MailRunIni "MailRun" "MailRunDir" MailRunDir
- if !(findstring(BBSType, "PCBoard"))
- when quiet 1 call checkfileprompt
- holding()
- clearwhen quiet
- endif
- if findstring(BBSType, "Auntie")
- transmit "LN;;^M"
- elseif findstring(BBSType, "PCBoard")
- transmit "N;U^M"
- elseif findstring(BBSType, "WildCat")
- transmit "N^M"
- elseif findstring(BBSType, "RBBS")
- transmit "N;S;A^M"
- endif
- when quiet 1 call checkprompt
- holding()
- clearwhen quiet
- capture OFF
- if !(findstring(BBSType, "PCBoard"))
- when quiet 1 call checkmainprompt
- holding()
- clearwhen quiet
- endif
- BBSLst = makefullname(MailRunDir, BBS)
- strcat BBSLst ".lst"
- TmpCap = makefullname(MailRunDir, "_tmp.cap")
- copyfile TmpCap BBSLst
- delfile TmpCap
- set capture file CapFile
- if LogRun
- if AnsiInLog
- set capture mode append RAW
- else
- set capture mode append VISUAL
- endif
- capture ON
- endif
- endproc
-
- proc checkprompt
- string CommandPrompt, FilePrompt, MorePrompt, ContinuePrompt
- profilerd MailRun BBS "CommandPrompt" CommandPrompt
- profilerd MailRun BBS "FilePrompt" FilePrompt
- profilerd MailRun BBS "MorePrompt" MorePrompt
- profilerd MailRun BBS "ContinuePrompt" ContinuePrompt
- if findstring(prompt, CommandPrompt) || findstring(prompt, FilePrompt)
- endhold()
- elseif findstring(BBSType, "Auntie") && findstring(prompt, "More (")
- transmit "NS^M"
- elseif findstring(prompt, MorePrompt)
- transmit "NS^M"
- elseif findstring(BBSType, "Auntie") && findstring(prompt, ContinuePrompt)
- transmit "^M"
- elseif findstring(prompt, ContinuePrompt)
- transmit "y^M"
- elseif findstring(BBSType, "WildCat") && findstring(prompt, "[L]ast new")
- transmit "L^M"
- elseif (findstring(BBSType, "PCBoard") && \
- findstring(prompt, "(Enter)=?")) || (findstring(BBSType, "WildCat") && \
- findstring(prompt, "ENTER = All"))
- transmit "^M"
- endif
- endproc
-
- proc checkfileprompt
- string FilePrompt, CommandPrompt
- profilerd MailRun BBS "FilePrompt" FilePrompt
- profilerd MailRun BBS "CommandPrompt" CommandPrompt
- if findstring(prompt, CommandPrompt)
- transmit "f^M"
- elseif findstring(prompt, FilePrompt)
- endhold()
- endif
- endproc
-
- proc checkmainprompt
- string FilePrompt, CommandPrompt
- profilerd MailRun BBS "FilePrompt" FilePrompt
- profilerd MailRun BBS "CommandPrompt" CommandPrompt
- if findstring(prompt, FilePrompt)
- if !(findstring(BBSType, "RBBS"))
- transmit "q^M"
- else
- transmit "q;m^M"
- endif
- elseif findstring(prompt, CommandPrompt)
- endhold()
- endif
- endproc
-
- proc holding
- string LastPrompt
- integer IdleTimeout
- profilerd MailRun "MailRun" "IdleTimeout" IdleTimeout
- IdleTimer = 1
- holdstatus = 1
- prompt = ""
- while (IdleTimer < IdleTimeout) && (holdstatus == 1) && $CARRIER
- pause 1
- termgets $ROW 0 prompt 75
- if not strcmp prompt LastPrompt
- ;if anything has been received, reset the timer
- IdleTimer = 1
- endif
- LastPrompt = prompt
- IdleTimer++
- endwhile
- if (IdleTimer == IdleTimeout) || ($CARRIER == 0)
- ;If there has been a timeout, lost carrier or user escape...
- clearwhen quiet
- ;set FailCode and get out
- if IdleTimer == IdleTimeout
- capturestr "`r`n`r`n***** Timed out waiting for prompt *****`r`n`r`n"
- else
- capturestr "`r`n`r`n************* Lost carrier *************`r`n`r`n"
- endif
- endif
- endproc
-
- proc endhold
- holdstatus = 0
- endproc
-
- func findstring : integer
- strparm String1, String2
- integer i = 0
- if not NULLSTR String2
- if strfind String1 String2
- i = 1
- endif
- endif
- return i
- endfunc
-
- func makefullname : string
- strparm Directory, FileNamen
- string FullName
- FullName = Directory
- addfilename FullName FileNamen
- return FullName
- endfunc
-
-